package com.itheima.edu.info.manager.D_Dao;

import com.itheima.edu.info.manager.E_domain.Student;

import java.util.ArrayList;
import java.util.Scanner;

//仓管类：进行增删查改;
public class StudentDao implements BaseStudentDao {
    //创建容器：
        static ArrayList<Student> list = new ArrayList<>();
    static {
        list.add(new Student("223","新民",23,"3456"));
        list.add(new Student("223","re",222,"3456"));
        list.add(new Student("223","ww",34,"3456"));
    }
    //添加方法：
    public boolean addStudent(Student student) {
        //将学生对象传递给容器
        list.add(student);
        return true;
    }

    public ArrayList<Student> findAllStudent() {
        return list;
    }

    public void updateStudent(Student student,int index) {
        list.set(index,student);
    }

    public void deleteStudent(int index) {//明天将底下判断移入service，在service中进行判断，获取id,再在dao中进行删除。
        list.remove(index);
    }
}
